This invention relates to a microcomputer comprising a semiconductor memory which is programmable and erasable, and in particular, to a microcomputer comprising a flash EEPROM, and a method of erasing the flash EEPROM.
In general, this kind of microcomputer comprises a flash EEPROM wherein an user program, such as an application program, can be programed.
Conventionally, proposal has been made about so called a self-programing system in which a memory content of the flash memory can be rewritten to the other program by a user on the condition that the microcomputer is mounted on a mounting substrate, as disclosed in Japanese Unexamined Patent Publication No. Hei. 5-266219 (reference 1). The reference 1 discloses a mode wherein a program is directly written to the flash EEPROM by a general purpose PROM writer and a mode wherein a program is written under the control of a central processing unit (CPU) inside the microcomputer, as a mode for rewriting the program in the flash EEPROM by the user. Where the program from the general-purpose PROM writer is used, the CPU inside the microcomputer is separated from the flash EEPROM, and the program in the flash EEPROM can be rewritten under the control of the general-purpose PROM writer.
On the other hand, where the program in the flash EEPROM is rewritten under the control of the CPU, a rewrite control program for controlling the rewrite of the program is necessary besides a program to be rewritten. The rewrite control program is stored in the flash EEPROM or a mask ROM in the above reference 1. Where the rewrite control program is stored in the flash EEPROM, the rewrite control program is transferred to the RAM with a transfer control program. Thereafter, a new program is written to the flash EEPROM under the control of the rewrite control program stored in the RAM. Further, where the rewrite control program is stored in the mask ROM, the flash EEPROM is rewritten by the rewrite control program in the mask ROM.
At any rate, the flash EEPROM must be once erased to rewrite the flash memory. Therefore, proposals have been made about a method for erasing the entire memory region comprising a plurality of memory cells, and a method for dividing the memory region into a plurality blocks and erasing each block, as methods for erasing the flash EEPROM. In such a method for erasing the entirety, all programs in the flash EEPROM can be erased in a short duration, whereas a long duration is necessary to rewrite the programs because all programs must be rewritten.
Further, where the flash EEPROM is divided to a plurality of blocks, the erasing operation can be carried out for each block. However, when the number of the blocks is increased, a long duration is necessary to erase the flash EEPROM, since about two seconds is required to erase each of the blocks.
Conventionally, Unexamined Japanese Patent Publication No. H5-325576 (reference 2) discloses such a method that a latch is provided in accordance with the block of the flash EEPROM, the block to be erased is designated by the latch and the designated block is erased, as a method for erasing the flash memory. Where this easing method is employed, an arbitrary block can be erased. However, the number of the latches must be increased with the number of the blocks. In addition, means for designating the latch is needed.
Further, Unexamined Japanese Patent Publication No. H7-98991 (reference 3) discloses such a non-volatile semiconductor memory that a plurality address signals can be latched for a plurality of erasing blocks and thereby, the block can be once erased with various combination. Such a structure has a limitation that the number of the address signals must be equal to the number of the blocks. Therefore, the number of the latches must be increased with the number of the blocks.
On the other hand, User's demand has been recently enhanced for the microcomputer which is specialized for each user by storing the program necessary to each user. To comply with this demand, it must be considered that a program (boot program) for rewriting a user program is necessary in addition to an user program. In this case, the boot program is different in accordance with each user and the block for storing the boot program is also different in accordance with the boot program. In this circumstance, where an occurrence of a bag is considered, it is desirable that the user program itself can be rewritten. However, it is rare that the boot program itself is rewritten because the boot program is inherent to the user in many cases.
In this event, it may be considered that both the user program and the boot program may be stored in the flash EEPROM in accordance with the user's demand, and further the references 1 to 3 are applied to erase the programs.
However, none of the references 1 to 3 suggest that the user program and the boot program are designated and stored in the flash EEPROM. In the reference 1, a rewrite control program is transferred to a RAM and thereafter, all blocks is erased. Further, although the references 2 and 3 disclose that the block to be erased is designated by the latch, neither of the references disclose a relation between the user and boot programs and the erasing block. In addition, neither of the references discloses an erasing circuit and an erasing method in the case that the user program and the boot program are stored in the flash EEPROM. For example, where the user program is stored in a plurality of blocks, a long duration is necessary to erase the flash EEPROM because the memory content must be erased for each block. Further, where the latch is provided in accordance with the block like the references 2 and 3, the control of the latch is difficult.